/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package management;

import entity.Bill_Detail;
import java.sql.PreparedStatement;

/**
 *
 * @author Windows7
 */
public class ManagerBillDetail {

    public static String sqlTbl_BillDetail = "select * from Bill_Detail";
    public static String bill_Id = "select top 1 Bill_Id from Bill order by (Bill_Id) desc ";
    public static String viewBill = "select Menu_Id,Menu_Price, Amount, from Menu inner join Bill_Detail on Menu.Menu_Id = Bill_Detail.Menu_Id where Customer_Id = 1 and Create_Date = getdate() ";
    public static String viewBillNew  = "select  Menu.Menu_Id,Menu_Price,Amount from Bill inner join Bill_Detail on .Bill.Bill_Id = Bill_Detail.Bill_Id inner join Menu on Bill_Detail.Menu_Id = Menu.Menu_Id where Bill_Detail.Bill_Id = (select top 1 Bill_Id from Bill order by (Bill_Id) desc )";
    public static String viewBilltt = "select  Bill_Id, Bill.Customer_Id,Cus_UserName, Staff_Id,Create_Date, Total_Money from Bill inner join Customer on Bill.Customer_Id = Customer.Customer_Id  where Bill_Id = (select top 1 Bill_Id from Bill order by (Bill_Id) desc )";
    
    public static boolean addBillDetail(int id ,int Mn_Id, int num) {
        try {
            PreparedStatement ps;
            String sql = "insert into Bill_Detail values('"+id+"','" + Mn_Id + "','" + num + "')";
            ps = MyConnection.getConnection().prepareStatement(sql);
            ps.executeUpdate();
            return true;
        } catch (Exception ex) {
            ex.printStackTrace();
            return false;
        }
    }
}
